/*
 Navicat Premium Dump SQL

 Source Server         : system postgres
 Source Server Type    : PostgreSQL
 Source Server Version : 160002 (160002)
 Source Host           : 192.168.220.128:15432
 Source Catalog        : BiJi
 Source Schema         : album

 Target Server Type    : PostgreSQL
 Target Server Version : 160002 (160002)
 File Encoding         : 65001

 Date: 19/09/2024 21:31:17
*/


-- ----------------------------
-- Sequence structure for image_meta_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "album"."image_meta_id_seq";
CREATE SEQUENCE "album"."image_meta_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1;

-- ----------------------------
-- Table structure for album
-- ----------------------------
DROP TABLE IF EXISTS "album"."album";
CREATE TABLE "album"."album" (
  "id" char(10) COLLATE "pg_catalog"."default" NOT NULL DEFAULT nanoid(10),
  "name" varchar(16) COLLATE "pg_catalog"."default" NOT NULL,
  "description" varchar(30) COLLATE "pg_catalog"."default",
  "create_ts" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  "update_ts" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  "owner" int4
)
;
COMMENT ON COLUMN "album"."album"."id" IS '相册id';
COMMENT ON COLUMN "album"."album"."name" IS '相册名称';
COMMENT ON COLUMN "album"."album"."description" IS '描述';
COMMENT ON COLUMN "album"."album"."create_ts" IS '创建时间';
COMMENT ON COLUMN "album"."album"."update_ts" IS '最后更新时间';

-- ----------------------------
-- Records of album
-- ----------------------------
INSERT INTO "album"."album" VALUES ('0000000000', '默认相册', '初始相册', '2024-09-19 13:20:12.481885', '2024-09-19 13:20:12.481885', NULL);

-- ----------------------------
-- Table structure for album_bind
-- ----------------------------
DROP TABLE IF EXISTS "album"."album_bind";
CREATE TABLE "album"."album_bind" (
  "id" int4 NOT NULL DEFAULT nextval('image_meta_id_seq'::regclass),
  "album_id" char(10) COLLATE "pg_catalog"."default" NOT NULL DEFAULT 0,
  "image_id" int4 NOT NULL,
  "sort_order" int4 DEFAULT 0
)
;

-- ----------------------------
-- Records of album_bind
-- ----------------------------

-- ----------------------------
-- Table structure for image_meta
-- ----------------------------
DROP TABLE IF EXISTS "album"."image_meta";
CREATE TABLE "album"."image_meta" (
  "id" int4 NOT NULL DEFAULT nextval('image_meta_id_seq'::regclass),
  "uri" text COLLATE "pg_catalog"."default",
  "filename" text COLLATE "pg_catalog"."default",
  "file_path" text COLLATE "pg_catalog"."default",
  "upload_ts" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  "uploader_id" int4,
  "mime_type" varchar(255) COLLATE "pg_catalog"."default",
  "platform" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "album"."image_meta"."id" IS '图片id';
COMMENT ON COLUMN "album"."image_meta"."uri" IS '链接';
COMMENT ON COLUMN "album"."image_meta"."filename" IS '图片名称';
COMMENT ON COLUMN "album"."image_meta"."file_path" IS '文件路径';
COMMENT ON COLUMN "album"."image_meta"."platform" IS '平台：local，阿里OSS，七牛';

-- ----------------------------
-- Records of image_meta
-- ----------------------------

-- ----------------------------
-- Function structure for armor
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."armor"(bytea);
CREATE OR REPLACE FUNCTION "album"."armor"(bytea)
  RETURNS "pg_catalog"."text" AS '$libdir/pgcrypto', 'pg_armor'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for armor
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."armor"(bytea, _text, _text);
CREATE OR REPLACE FUNCTION "album"."armor"(bytea, _text, _text)
  RETURNS "pg_catalog"."text" AS '$libdir/pgcrypto', 'pg_armor'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for crypt
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."crypt"(text, text);
CREATE OR REPLACE FUNCTION "album"."crypt"(text, text)
  RETURNS "pg_catalog"."text" AS '$libdir/pgcrypto', 'pg_crypt'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for dearmor
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."dearmor"(text);
CREATE OR REPLACE FUNCTION "album"."dearmor"(text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pg_dearmor'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for decrypt
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."decrypt"(bytea, bytea, text);
CREATE OR REPLACE FUNCTION "album"."decrypt"(bytea, bytea, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pg_decrypt'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for decrypt_iv
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."decrypt_iv"(bytea, bytea, bytea, text);
CREATE OR REPLACE FUNCTION "album"."decrypt_iv"(bytea, bytea, bytea, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pg_decrypt_iv'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for digest
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."digest"(bytea, text);
CREATE OR REPLACE FUNCTION "album"."digest"(bytea, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pg_digest'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for digest
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."digest"(text, text);
CREATE OR REPLACE FUNCTION "album"."digest"(text, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pg_digest'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for encrypt
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."encrypt"(bytea, bytea, text);
CREATE OR REPLACE FUNCTION "album"."encrypt"(bytea, bytea, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pg_encrypt'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for encrypt_iv
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."encrypt_iv"(bytea, bytea, bytea, text);
CREATE OR REPLACE FUNCTION "album"."encrypt_iv"(bytea, bytea, bytea, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pg_encrypt_iv'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for gen_random_bytes
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."gen_random_bytes"(int4);
CREATE OR REPLACE FUNCTION "album"."gen_random_bytes"(int4)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pg_random_bytes'
  LANGUAGE c VOLATILE STRICT
  COST 1;

-- ----------------------------
-- Function structure for gen_random_uuid
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."gen_random_uuid"();
CREATE OR REPLACE FUNCTION "album"."gen_random_uuid"()
  RETURNS "pg_catalog"."uuid" AS '$libdir/pgcrypto', 'pg_random_uuid'
  LANGUAGE c VOLATILE
  COST 1;

-- ----------------------------
-- Function structure for gen_salt
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."gen_salt"(text, int4);
CREATE OR REPLACE FUNCTION "album"."gen_salt"(text, int4)
  RETURNS "pg_catalog"."text" AS '$libdir/pgcrypto', 'pg_gen_salt_rounds'
  LANGUAGE c VOLATILE STRICT
  COST 1;

-- ----------------------------
-- Function structure for gen_salt
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."gen_salt"(text);
CREATE OR REPLACE FUNCTION "album"."gen_salt"(text)
  RETURNS "pg_catalog"."text" AS '$libdir/pgcrypto', 'pg_gen_salt'
  LANGUAGE c VOLATILE STRICT
  COST 1;

-- ----------------------------
-- Function structure for hmac
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."hmac"(bytea, bytea, text);
CREATE OR REPLACE FUNCTION "album"."hmac"(bytea, bytea, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pg_hmac'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for hmac
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."hmac"(text, text, text);
CREATE OR REPLACE FUNCTION "album"."hmac"(text, text, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pg_hmac'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for nanoid
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."nanoid"("size" int4, "alphabet" text, "additionalbytesfactor" float8);
CREATE OR REPLACE FUNCTION "album"."nanoid"("size" int4=21, "alphabet" text='_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'::text, "additionalbytesfactor" float8=1.6)
  RETURNS "pg_catalog"."text" AS $BODY$
DECLARE
    alphabetArray  text[];
    alphabetLength int := 64;
    mask           int := 63;
    step           int := 34;
BEGIN
    IF size IS NULL OR size < 1 THEN
        RAISE EXCEPTION 'The size must be defined and greater than 0!';
    END IF;

    IF alphabet IS NULL OR length(alphabet) = 0 OR length(alphabet) > 255 THEN
        RAISE EXCEPTION 'The alphabet can''t be undefined, zero or bigger than 255 symbols!';
    END IF;

    IF additionalBytesFactor IS NULL OR additionalBytesFactor < 1 THEN
        RAISE EXCEPTION 'The additional bytes factor can''t be less than 1!';
    END IF;

    alphabetArray := regexp_split_to_array(alphabet, '');
    alphabetLength := array_length(alphabetArray, 1);
    mask := (2 << cast(floor(log(alphabetLength - 1) / log(2)) as int)) - 1;
    step := cast(ceil(additionalBytesFactor * mask * size / alphabetLength) AS int);

    IF step > 1024 THEN
        step := 1024; -- The step size % can''t be bigger then 1024!
    END IF;

    RETURN nanoid_optimized(size, alphabet, mask, step);
END
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for nanoid_optimized
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."nanoid_optimized"("size" int4, "alphabet" text, "mask" int4, "step" int4);
CREATE OR REPLACE FUNCTION "album"."nanoid_optimized"("size" int4, "alphabet" text, "mask" int4, "step" int4)
  RETURNS "pg_catalog"."text" AS $BODY$
DECLARE
    idBuilder      text := '';
    counter        int  := 0;
    bytes          bytea;
    alphabetIndex  int;
    alphabetArray  text[];
    alphabetLength int  := 64;
BEGIN
    alphabetArray := regexp_split_to_array(alphabet, '');
    alphabetLength := array_length(alphabetArray, 1);

    LOOP
        bytes := gen_random_bytes(step);
        FOR counter IN 0..step - 1
            LOOP
                alphabetIndex := (get_byte(bytes, counter) & mask) + 1;
                IF alphabetIndex <= alphabetLength THEN
                    idBuilder := idBuilder || alphabetArray[alphabetIndex];
                    IF length(idBuilder) = size THEN
                        RETURN idBuilder;
                    END IF;
                END IF;
            END LOOP;
    END LOOP;
END
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for pgp_armor_headers
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_armor_headers"(text, OUT "key" text, OUT "value" text);
CREATE OR REPLACE FUNCTION "album"."pgp_armor_headers"(IN text, OUT "key" text, OUT "value" text)
  RETURNS SETOF "pg_catalog"."record" AS '$libdir/pgcrypto', 'pgp_armor_headers'
  LANGUAGE c IMMUTABLE STRICT
  COST 1
  ROWS 1000;

-- ----------------------------
-- Function structure for pgp_key_id
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_key_id"(bytea);
CREATE OR REPLACE FUNCTION "album"."pgp_key_id"(bytea)
  RETURNS "pg_catalog"."text" AS '$libdir/pgcrypto', 'pgp_key_id_w'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_pub_decrypt
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_pub_decrypt"(bytea, bytea);
CREATE OR REPLACE FUNCTION "album"."pgp_pub_decrypt"(bytea, bytea)
  RETURNS "pg_catalog"."text" AS '$libdir/pgcrypto', 'pgp_pub_decrypt_text'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_pub_decrypt
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_pub_decrypt"(bytea, bytea, text);
CREATE OR REPLACE FUNCTION "album"."pgp_pub_decrypt"(bytea, bytea, text)
  RETURNS "pg_catalog"."text" AS '$libdir/pgcrypto', 'pgp_pub_decrypt_text'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_pub_decrypt
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_pub_decrypt"(bytea, bytea, text, text);
CREATE OR REPLACE FUNCTION "album"."pgp_pub_decrypt"(bytea, bytea, text, text)
  RETURNS "pg_catalog"."text" AS '$libdir/pgcrypto', 'pgp_pub_decrypt_text'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_pub_decrypt_bytea
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_pub_decrypt_bytea"(bytea, bytea);
CREATE OR REPLACE FUNCTION "album"."pgp_pub_decrypt_bytea"(bytea, bytea)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pgp_pub_decrypt_bytea'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_pub_decrypt_bytea
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_pub_decrypt_bytea"(bytea, bytea, text);
CREATE OR REPLACE FUNCTION "album"."pgp_pub_decrypt_bytea"(bytea, bytea, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pgp_pub_decrypt_bytea'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_pub_decrypt_bytea
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_pub_decrypt_bytea"(bytea, bytea, text, text);
CREATE OR REPLACE FUNCTION "album"."pgp_pub_decrypt_bytea"(bytea, bytea, text, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pgp_pub_decrypt_bytea'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_pub_encrypt
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_pub_encrypt"(text, bytea, text);
CREATE OR REPLACE FUNCTION "album"."pgp_pub_encrypt"(text, bytea, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pgp_pub_encrypt_text'
  LANGUAGE c VOLATILE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_pub_encrypt
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_pub_encrypt"(text, bytea);
CREATE OR REPLACE FUNCTION "album"."pgp_pub_encrypt"(text, bytea)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pgp_pub_encrypt_text'
  LANGUAGE c VOLATILE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_pub_encrypt_bytea
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_pub_encrypt_bytea"(bytea, bytea, text);
CREATE OR REPLACE FUNCTION "album"."pgp_pub_encrypt_bytea"(bytea, bytea, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pgp_pub_encrypt_bytea'
  LANGUAGE c VOLATILE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_pub_encrypt_bytea
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_pub_encrypt_bytea"(bytea, bytea);
CREATE OR REPLACE FUNCTION "album"."pgp_pub_encrypt_bytea"(bytea, bytea)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pgp_pub_encrypt_bytea'
  LANGUAGE c VOLATILE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_sym_decrypt
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_sym_decrypt"(bytea, text, text);
CREATE OR REPLACE FUNCTION "album"."pgp_sym_decrypt"(bytea, text, text)
  RETURNS "pg_catalog"."text" AS '$libdir/pgcrypto', 'pgp_sym_decrypt_text'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_sym_decrypt
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_sym_decrypt"(bytea, text);
CREATE OR REPLACE FUNCTION "album"."pgp_sym_decrypt"(bytea, text)
  RETURNS "pg_catalog"."text" AS '$libdir/pgcrypto', 'pgp_sym_decrypt_text'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_sym_decrypt_bytea
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_sym_decrypt_bytea"(bytea, text);
CREATE OR REPLACE FUNCTION "album"."pgp_sym_decrypt_bytea"(bytea, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pgp_sym_decrypt_bytea'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_sym_decrypt_bytea
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_sym_decrypt_bytea"(bytea, text, text);
CREATE OR REPLACE FUNCTION "album"."pgp_sym_decrypt_bytea"(bytea, text, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pgp_sym_decrypt_bytea'
  LANGUAGE c IMMUTABLE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_sym_encrypt
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_sym_encrypt"(text, text, text);
CREATE OR REPLACE FUNCTION "album"."pgp_sym_encrypt"(text, text, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pgp_sym_encrypt_text'
  LANGUAGE c VOLATILE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_sym_encrypt
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_sym_encrypt"(text, text);
CREATE OR REPLACE FUNCTION "album"."pgp_sym_encrypt"(text, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pgp_sym_encrypt_text'
  LANGUAGE c VOLATILE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_sym_encrypt_bytea
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_sym_encrypt_bytea"(bytea, text, text);
CREATE OR REPLACE FUNCTION "album"."pgp_sym_encrypt_bytea"(bytea, text, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pgp_sym_encrypt_bytea'
  LANGUAGE c VOLATILE STRICT
  COST 1;

-- ----------------------------
-- Function structure for pgp_sym_encrypt_bytea
-- ----------------------------
DROP FUNCTION IF EXISTS "album"."pgp_sym_encrypt_bytea"(bytea, text);
CREATE OR REPLACE FUNCTION "album"."pgp_sym_encrypt_bytea"(bytea, text)
  RETURNS "pg_catalog"."bytea" AS '$libdir/pgcrypto', 'pgp_sym_encrypt_bytea'
  LANGUAGE c VOLATILE STRICT
  COST 1;

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "album"."image_meta_id_seq"
OWNED BY "album"."image_meta"."id";
SELECT setval('"album"."image_meta_id_seq"', 1, false);

-- ----------------------------
-- Primary Key structure for table album
-- ----------------------------
ALTER TABLE "album"."album" ADD CONSTRAINT "album_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Uniques structure for table album_bind
-- ----------------------------
ALTER TABLE "album"."album_bind" ADD CONSTRAINT "unique_album_image" UNIQUE ("album_id", "image_id");

-- ----------------------------
-- Primary Key structure for table album_bind
-- ----------------------------
ALTER TABLE "album"."album_bind" ADD CONSTRAINT "album_bind_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table image_meta
-- ----------------------------
ALTER TABLE "album"."image_meta" ADD CONSTRAINT "image_meta_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Foreign Keys structure for table album_bind
-- ----------------------------
ALTER TABLE "album"."album_bind" ADD CONSTRAINT "album_bind_album_id_fkey" FOREIGN KEY ("album_id") REFERENCES "album"."album" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "album"."album_bind" ADD CONSTRAINT "album_bind_image_id_fkey" FOREIGN KEY ("image_id") REFERENCES "album"."image_meta" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
